package com.twu.biblioteca.library;

import java.util.TreeMap;

public class Movies {
    private TreeMap<String, Movie> allMovies = new TreeMap<String, Movie>();

    public void setAllMovies(TreeMap<String, Movie> allMovies) {
        this.allMovies = allMovies;
    }

    public String viewAllMovies() {
        StringBuffer allMoviesInfo = new StringBuffer();
        for (Movie movie : allMovies.values()) {
            allMoviesInfo.append(movie.toString() + "\n");
        }
        return allMoviesInfo.toString();
    }


    public void addMovie(Movie movie) {
        String movieID = String.valueOf(allMovies.size() + 1);
        allMovies.put(movieID, movie);
    }

    public int getTotalNumberOfMovies() {
        return allMovies.size();
    }
}
